package com.zhidisoft.admin.mapper;

import java.math.BigInteger;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.zhidisoft.admin.entity.ArticleType;

public interface IArticleTypeMapper {
	
	/**
	 * 添加
	 * @param articleType
	 * @return
	 */
	@Insert("insert into article_type(id,name) value(#{id},#{name})")
	public int save(ArticleType articleType);
	
	/**
	 * 删除
	 * @param id
	 * @return
	 */
	@Delete("delete from article_type where id = #{id}")
	public int deleteById(@Param("id") String id);
	
	/**
	 * 修改
	 * @param username
	 * @param id
	 * @return
	 
	@Update("update article set article")
	public int update(Article article, @Param("id") String id);*/
	
	/**
	 * 根据id查询单个
	 * @param id
	 * @return
	 */
	@Select("SELECT * FROM article_type WHERE id = #{id}")
	public ArticleType findById(@Param("id") String id);
	
	/**
	 * 分页查询
	 * @param startIndex
	 * @param pageSize
	 * @return
	 */
	@Select("select * from article_type limit #{startIndex},#{pageSize}")
	public List<ArticleType> pageList(@Param("startIndex") Integer startIndex,@Param("pageSize") Integer pageSize);
	
	/**
	 * 获取总条数
	 * @return
	 */
	@Select("SELECT count(id) FROM article_type")
	public BigInteger totalCount();

	@Select("SELECT * FROM article_type")
	public List<ArticleType> getArticleTypes();

	
	public void update(ArticleType articleType);
}
